package com.huawei123.hasee.cniao5store.adapter.top;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.GridView;

import com.huawei123.hasee.cniao5store.R;
import com.huawei123.hasee.cniao5store.bean.CategoryBean;
import com.huawei123.hasee.cniao5store.utils.UIUtils;
import com.zhxu.recyclerview.wrapper.HeaderAndFooterWrapper;

import java.util.List;

/**
 * 项目名称：Cniao5Store
 * 类描述：分类头部四按键实现
 * 创建人：luohao
 * 创建时间：2018/2/4 18:00
 * 修改人：luohao
 * 修改时间：2018/2/4 18:00
 * 修改备注：
 */

public class CategoryTopWrapper extends HeaderAndFooterWrapper {

    private final Context context;
    private GridView mGV_title_grid;

    public CategoryTopWrapper(Context context, RecyclerView.Adapter adapter) {
        super(adapter);
        this.context = context;
        View headerView = UIUtils.inflate(R.layout.header_top);
        //在表格布局中添加四个按键
        mGV_title_grid = (GridView) headerView.findViewById(R.id.mGV_title_grid);
        addHeaderView(headerView);//将头部视图添加到框架中
    }

    public void addAllData(List<CategoryBean.CategoryTopBean> dataBeanList) {
        CategoryAubAdapter categoryAubAdapter = new CategoryAubAdapter(context, dataBeanList);
        mGV_title_grid.setNumColumns(dataBeanList.size());
        mGV_title_grid.setAdapter(categoryAubAdapter);
    }


}
